﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Xml;

namespace Heyo.Pages
{
    public sealed class ModalDialogPage:DialogPage
    {
        public ModalDialogPage(object dataContext,string title,UIElement xaml,bool closeBtn=true)
        {
            DataContext = dataContext;
            //StringReader stringReader = new StringReader(xaml);
            //XmlReader xmlReader = XmlReader.Create(stringReader);
            Title = title;
            //UIElement clonedChild = (UIElement)XamlReader.Load(xmlReader);
            //if (clonedChild is FrameworkElement frameworkElement)
            //{
            //    frameworkElement.DataContext = dataContext;
            //}
                
            AddChild(xaml);
            //AddChild(clonedChild);
            ShowCloseButton = closeBtn;
        }
    }
}
